Skip to content

fix(parser): handle quotes inside ${...} in double-quoted strings#483

Merged
chaliy merged 1 commit intomainfrom
claude/fix-399-Y2nIj
Mar 2, 2026
Merged

fix(parser): handle quotes inside ${...} in double-quoted strings#483
chaliy merged 1 commit intomainfrom
claude/fix-399-Y2nIj

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Mar 2, 2026

Summary

  • Fixed ${arr["key"]} inside double-quoted strings being misparsed
  • Root cause: lexer's read_double_quoted_string didn't track ${...} brace depth, so inner " terminated the outer string
  • Added read_param_expansion_into() to track brace depth inside parameter expansions
  • Also strips surrounding quotes from array indices during parsing

Closes #399

Test plan

  • test_assoc_array_in_double_quotes
  • test_assoc_array_keys_in_quotes
  • vop_backslash_in_default spec test still passes
  • All 1809 tests pass

The lexer now tracks ${...} brace depth inside double-quoted strings
so that inner quotes (e.g. ${arr["key"]}) don't terminate the outer
string. Also strips surrounding quotes from array indices during parsing.

Closes #399

https://claude.ai/code/session_01WZjYqxm5xMPAEe7FSHJkDy
@chaliy chaliy force-pushed the claude/fix-399-Y2nIj branch from a031674 to 03a299a Compare March 2, 2026 20:10
@chaliy chaliy merged commit 1d80c0f into main Mar 2, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(parser): associative array access inside double quotes misparsed

2 participants